package com.anasoft.os.s4j;

import org.junit.runner.notification.RunListener;

import com.anasoft.os.s4j.annotation.ErrorReporting;
import com.anasoft.os.s4j.annotation.SeleniumSession;
import com.thoughtworks.selenium.Selenium;

/**
 * Describes common operations for Selenium test runners.
 * 
 * @see SeleniumTestRunner
 * @see SeleniumSuiteRunner
 * 
 * @author vojtech.szocs
 */
public interface SeleniumRunnerLogic {

    /**
     * Returns a {@link RunListener} that implements the error reporting
     * behavior of Selenium tests in relation to the {@link ErrorReporting}
     * annotation.
     * 
     * @param errorConfig Error reporting configuration retrieved
     * from {@link SeleniumSession}.
     * @param session Selenium API for executing commands on the current
     * session.
     * @return {@link RunListener} that implements the error reporting
     * behavior.
     */
    RunListener getErrorReportingListener(ErrorReporting errorConfig, Selenium session);
    
    /**
     * Returns a {@link SeleniumSessionListener} that gets notified upon
     * events related to the current {@link Selenium} session.
     * 
     * @return {@link SeleniumSessionListener} reacting to session events.
     */
    SeleniumSessionListener getSessionListener();
    
}
